import {useEffect} from "react";
import {useNavigate, useParams} from "react-router-dom";
import {payMedicineHistory} from "../../api/medicineList.js";
import {handleResult, handleResultNoRoute} from "../../api/result.js";
import {useToast} from "@chakra-ui/react";

export function MedicineHistoryPayPage() {
    const {id: mhid} = useParams()
    let toast = useToast()
    const navigator = useNavigate()

    useEffect(() => {
        // 设置药单status-1
        payMedicineHistory(mhid).then(r => {
            handleResultNoRoute(r, toast, '', '支付成功')
            navigator('/')
        })
    }, []);
    return (
        <h1 className={'my-4'}>支付成功!</h1>
    )
}